package com.qire.other.share;

import java.util.HashMap;

/**
 * 分享行为接口，用于工厂构建统一行为
 */
public interface ShareAction<T extends ShareAction> {

	/**
	 * 具体分享行为
	 * @param shareMap 包含分享参数的map
	 * @return
	 */
	boolean doShareAction(HashMap<String, Object> shareMap);

	/**
	 * 分享错误时监听
	 * @param shareErrorListener
	 * @return
	 */
	T setShareOnErrorListener(ShareErrorListener shareErrorListener);

	/**
	 * 分享取消时监听
	 * @param shareCancelListener
	 * @return
	 */
	T setShareOnCancelListener(ShareCancelListener shareCancelListener);

	/**
	 * 分享完成时监听
	 * @param shareCompleteListener
	 * @return
	 */
	T setShareOnCompleteListener(ShareCompleteListener shareCompleteListener);

	/**
	 * 综合监听，提供一次设置 成功 错误 取消3个行为的监听器
	 * @param shareActionListener
	 * @return
	 */
	T setShareActionListener(ShareActionListener shareActionListener);

	interface ShareErrorListener { void onShareError(); }

	interface ShareCancelListener { void onShareCancel(); }

	interface ShareCompleteListener { void onShareComplete(); }

	interface ShareActionListener extends ShareErrorListener, ShareCancelListener, ShareCompleteListener {}
}
